package com.bawei.network

import retrofit2.Retrofit

/**
 * @author ZhangRuiPeng
 * @description:
 */
class RetrofitFactory private constructor(){


    companion object{
        lateinit var retrofit: Retrofit
        private val tokenRetrofit : Retrofit by lazy { TokenRetrofit().getRetrofit() }
        private val signRetrofit : Retrofit by lazy { SignRetrofit().getRetrofit() }
        private val tsRetrofit : Retrofit by lazy { TsRetrofit().getRetrofit() }
        private val noneRetrofit : Retrofit by lazy { NoneRetrofit().getRetrofit() }


        fun factory(type : HttpType):Retrofit{
            when(type){
                HttpType.TOKEN->{
                    retrofit = tokenRetrofit
                }
                HttpType.NONE->{
                    retrofit = noneRetrofit
                }
                HttpType.SIGN->{
                    retrofit = signRetrofit
                }
                HttpType.TS->{
                    retrofit = tsRetrofit
                }
            }
            return retrofit
        }
    }
}